package com.mazaiting.classfile.constant.info;

import com.mazaiting.classfile.ClassReader;
import com.mazaiting.classfile.constant.ConstantPool;
import com.mazaiting.util.ByteUtil;
import lombok.Getter;

import java.math.BigInteger;

/**
 * 使用8字节存储整数常量
 * @author mazaiting
 * @since 2021/8/11
 */
@Getter
public class ConstantLongInfo extends ConstantInfo{

    /**
     * Long 型数据
     */
    private long value;

    public ConstantLongInfo(ConstantPool pool) {
        super(pool);
    }

    @Override
    public void readInfo(ClassReader reader) {
        this.value = ByteUtil.byteToLong(reader.readU8());
    }

    @Override
    public String toString() {
        return "ConstantLongInfo{" +
                "value=" + value +
                '}';
    }
}
